<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Home</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="stylesheet" type="text/css" href="/Public/Home/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/Public/Home/css/nprogress.css">
<link rel="stylesheet" type="text/css" href="/Public/Home/css/style.css">
<link rel="stylesheet" type="text/css" href="/Public/Home/css/font-awesome.min.css">
<link rel="apple-touch-icon-precomposed" href="/Public/Home/images/icon.png">
<link rel="shortcut icon" href="/Public/Home/images/favicon.ico">
<script type="text/javascript" src="/Public/Admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script src="/Public/Home/js/nprogress.js"></script>
<script src="/Public/Home/js/jquery.lazyload.min.js"></script>
<!--[if gte IE 9]>
  <script src="/Public/Home/js/jquery-1.11.1.min.js" type="text/javascript"></script>
  <script src="/Public/Home/js/html5shiv.min.js" type="text/javascript"></script>
  <script src="/Public/Home/js/respond.min.js" type="text/javascript"></script>
  <script src="/Public/Home/js/selectivizr-min.js" type="text/javascript"></script>
<![endif]-->
</head>
<body class="user-select">
<header class="header">
<nav class="navbar navbar-default" id="navbar">
<div class="container">
  <div class="header-topbar hidden-xs link-border">
	<ul class="site-nav topmenu">
	  <li><a ></a></li>
	  <?php if(empty($user)): ?><li><a onclick="login('<?php echo U('Login/index');?>')" id="login" rel="nofollow" >登录</a></li>
		<li><a onclick="login('<?php echo U('Login/register');?>')" title="注册" >注册</a></li>
		<?php else: ?>
		<li><a href="<?php echo U('User/index');?>" target="_block" rel="nofollow" ><?php echo ($user['username']); ?></a></li>
		<li><a href="<?php echo U('Login/logout');?>" title="退出登录" >退出登录</a></li><?php endif; ?>
	</ul>
			 勤记录 懂分享</div>
  <div class="navbar-header">
	<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-navbar" aria-expanded="false"> <span class="sr-only"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
	<h1 class="logo hvr-bounce-in"><a href="#" title="木庄网络博客"><img src="/Public/Home/images/201610171329086541.png" alt="木庄网络博客"></a></h1>
  </div>
  <div class="collapse navbar-collapse" id="header-navbar">
	<form class="navbar-form visible-xs" action="/Search" method="post">
	  <div class="input-group">
		<input type="text" name="keyword" class="form-control" placeholder="请输入关键字" maxlength="20" autocomplete="off">
		<span class="input-group-btn">
		<button class="btn btn-default btn-search" name="search" type="submit">搜索</button>
		</span> </div>
	</form>
	<ul class="nav navbar-nav navbar-right">
	  <li><a data-cont="木庄网络博客" title="木庄网络博客" href="<?php echo U('Index/index');?>">首页</a></li>
	  <?php if(is_array($cats)): foreach($cats as $key=>$v): ?><li><a data-cont="<?php echo ($v['cat_name']); ?>" title="<?php echo ($v['cat_name']); ?>" href="<?php echo U('Blog/index',array('cat_id'=>$v['cat_id']));?>" ><?php echo ($v['cat_name']); ?></a></li><?php endforeach; endif; ?>
	</ul>
  </div>
</div>
</nav>
</header>


<link rel="stylesheet" type="text/css" href="/Public/Home/css/comment.css">
<section class="container">
<div class="content-wrap">
<div class="content">
  <header class="article-header">
	<h1 class="article-title"><a href="#" title="<?php echo ($blog['title']); ?>" ><?php echo ($blog['title']); ?></a></h1>
	<div class="article-meta"> 
	<span class="item article-meta-time">
	  <time class="time" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="发表时间：<?php echo (date('Y-m-d',$blog['time'])); ?>"><i class="glyphicon glyphicon-time"></i> <?php echo (date('Y-m-d',$blog['time'])); ?></time>
	  </span> 
	  <span class="item article-meta-source" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="来源：<?php echo ($blog['source']); ?>"><i class="glyphicon glyphicon-globe"></i> <?php echo ($blog['source']); ?></span> 
	  <span class="item article-meta-category" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="<?php if(is_array($cats)): $i = 0; $__LIST__ = $cats;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v['cat_id']==$blog['cat_id']): echo ($v['cat_name']); endif; endforeach; endif; else: echo "" ;endif; ?>"><i class="glyphicon glyphicon-list"></i> <a href="#" title="<?php if(is_array($cats)): $i = 0; $__LIST__ = $cats;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v['cat_id']==$blog['cat_id']): echo ($v['cat_name']); endif; endforeach; endif; else: echo "" ;endif; ?>" ><?php if(is_array($cats)): $i = 0; $__LIST__ = $cats;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v['cat_id']==$blog['cat_id']): echo ($v['cat_name']); endif; endforeach; endif; else: echo "" ;endif; ?></a></span> 
	  <span class="item article-meta-views" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="浏览量：<?php echo ($blog['count']); ?>"><i class="glyphicon glyphicon-eye-open"></i> <?php echo ($blog['count']); ?></span> 
	  <i class="glyphicon glyphicon-comment"></i><span class="item article-meta-comment" id="contact_count" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="评论量"> <?php echo ($blog['contact_count']); ?></span>
	  <span class="item article-meta-views" data-toggle="tooltip" data-placement="bottom" title="" onclick="collection(this,<?php echo ($blog['id']); ?>)"><?php if($state == 1): ?>已收藏<?php else: ?>收藏<?php endif; ?></span>  </div>
  </header>
  <article class="article-content">
	<?php echo ($blog['content']); ?>
	<div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a><a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a></div>

		  <script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "1", "bdSize": "32" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=0.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
  </article>
  <div class="article-tags">标签：
  
  <?php if(is_array($keys)): $i = 0; $__LIST__ = $keys;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><a href="###" rel="tag" ><?php echo ($v['key_name']); ?></a><?php endforeach; endif; else: echo "" ;endif; ?>
	</div>
  <div class="relates">
	<div class="title">
	  <h3>相关推荐</h3>
	</div>
	<ul>
	<?php if(is_array($xiangguan)): $i = 0; $__LIST__ = $xiangguan;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><li><a href="<?php echo U('index',array('blog_id'=>$v['id']));?>" title="" ><?php echo ($v['title']); ?>-<?php echo ($v['cat_name']); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
	 
	</ul>
  </div>
  <div class="title" id="comment">
	<h3>评论</h3>
  </div>
  <div id="respond">
		<form id="comment-form" name="comment-form" action="" method="POST">
			<div class="comment">
				<div id="postcomments">
				<ol id="comment_list" class=""> 
				<?php if(is_array($comments)): $k = 0; $__LIST__ = $comments;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($k % 2 );++$k;?><li class="">
					<div id="comment">
						<img src="/Public/Home/1234.jpg" />
						
						<?php echo getComment($blog_id,$v['pid']);?>
						
						<h5><?php echo ($v['username']); ?></h5>
						<p><?php echo ($v['content']); ?></p>
						<div class="contact"><a onclick="good(this,<?php echo ($v['id']); ?>)">顶[<span><?php echo ($v['good_count']); ?></span>]</a><a onclick="bad(this,<?php echo ($v['id']); ?>)">踩[<span><?php echo ($v['bad_count']); ?></span>]</a><a onclick="contact_back(this)">回复</a></div>
						<div class="comment-box lou_comment" style="display: none;">
					<textarea placeholder="您的评论或留言（必填）" name="content" id="comment-textarea" cols="100%" rows="3" tabindex="3"></textarea>
					<div class="comment-ctrl">
						<div class="comment-prompt" style="display: none;"> <i class="fa fa-spin fa-circle-o-notch"></i> <span class="comment-prompt-text">回复正在提交中...请稍后</span> </div>
						<div class="comment-success" style="display: none;"> <i class="fa fa-check"></i> <span class="comment-prompt-text">回复成功...</span> </div>
						<button type="button" onclick="comment(this,'<?php echo U('Comment/commentBack',array('comment_id'=>$v['id']));?>')" name="comment-submit" id="comment-submit" tabindex="4">回复</button>
					</div>
				</div>
					</div>
				</li><?php endforeach; endif; else: echo "" ;endif; ?>
				</ol>
			  </div>
			  
				<div class="comment-box">
					<textarea placeholder="您的评论或留言（必填）" name="content" id="comment-textarea" cols="100%" rows="3" tabindex="3"></textarea>
					<div class="comment-ctrl">
						<div class="comment-prompt" style="display: none;"> <i class="fa fa-spin fa-circle-o-notch"></i> <span class="comment-prompt-text">评论正在提交中...请稍后</span> </div>
						<div class="comment-success" style="display: none;"> <i class="fa fa-check"></i> <span class="comment-prompt-text">评论提交成功...</span> </div>
						<button type="button" onclick="comment(this,'<?php echo U('Comment/comment',array('blog_id'=>$blog_id));?>')" name="comment-submit" id="comment-submit" tabindex="4">评论</button>
					</div>
				</div>
			</div>
		</form>
		
	</div>
  
</div>
</div>
	
<aside class="sidebar">
<div class="fixed">
  <div class="widget widget-tabs">
	<ul class="nav nav-tabs" role="tablist">
	  <li role="presentation" class="active"><a href="#notice" aria-controls="notice" role="tab" data-toggle="tab" >统计信息</a></li>
	  <li role="presentation"><a href="#contact" aria-controls="contact" role="tab" data-toggle="tab" >联系站长</a></li>
	</ul>
	<div class="tab-content">
	  <div role="tabpanel" class="tab-pane contact active" id="notice">
		<h2>博客总数:
			  <?php echo ($all_blog); ?>篇
		  </h2>
		  <h2>网站运行:
		  <span id="sitetime">88天 </span></h2>
	  </div>
		<div role="tabpanel" class="tab-pane contact" id="contact">
		  <h2>QQ:
			  <a href="" target="_blank" rel="nofollow" data-toggle="tooltip" data-placement="bottom" title=""  data-original-title="QQ"><?php echo ($contact[0]['value']); ?></a>
		  </h2>
		  <h2>Email:
		  <a href="#" target="_blank" data-toggle="tooltip" rel="nofollow" data-placement="bottom" title=""  data-original-title="email"><?php echo ($contact[1]['value']); ?></a></h2>
	  </div>
	</div>
  </div>
  <div class="widget widget_search">
	<form class="navbar-form" action="<?php echo U('Search/index');?>" method="get">
	  <div class="input-group">
		<input type="text" name="keyword" class="form-control" size="35" placeholder="请输入关键字" maxlength="15" autocomplete="off">
		<span class="input-group-btn">
		<button class="btn btn-default btn-search" name="search" type="submit">搜索</button>
		</span> </div>
	</form>
  </div>
</div>
<?php echo W('New/hotBlog');?>
 <div class="widget widget_sentence">    
	<a href="#" target="_blank" rel="nofollow" title="专业网站建设" >
	<img style="width: 100%" src="/Public/Home/images//201610241224221511.jpg" alt="专业网站建设" ></a>    
 </div>
 
</aside>
</section>
<footer class="footer">
<div class="container">
 <p><?php echo ($copyright); ?></p>
</div>
<div id="gotop"><a class="gotop"></a></div>
</footer>

<script>
	//收藏文章
	function collection(obj,blog_id){
		$.post('<?php echo U("collection");?>',{blog_id:blog_id},function(data){
			if(data.status == 1){
				if(data.state == 1){ // 已收藏
					$(obj).text('已收藏');
				}else { // 未收藏
					$(obj).text('收藏')
				}
			}else{
				layer.msg(data.msg,{icon:5,time:1000});
			}
		});
	}

	function contact_back(obj){
		
		var comment = $(obj).parent('.contact').next('div');
		if(comment.css('display') == 'none'){
			$('.lou_comment').slideUp();
			
			comment.slideToggle();
		}else{
			comment.slideToggle();
		}
		
		
	}
	function comment(obj,url){
		
		$(obj).prev().prev().show();
		// 获取表单中的值
		var content = $(obj).parent('div').prev().val();
		
		$.post(url,{content:content,blog_id:<?php echo ($blog_id); ?>},function (data){
			if(data.status == 1){
				$(obj).prev().prev().hide(400,function (){
					$(obj).prev().show();
					setTimeout(function(){
						$(obj).prev().hide();
						location.reload();
					},500);
					var count = parseInt($("#contact_count").text())+1;
					$("#contact_count").text(' '+count);
					$('textarea[name=content]').val('');
				});
				
			}else{
				$(obj).prev().prev().hide();
				alert(data.msg);
			}
			
		});
	}
	
	function good(obj,id){
		$.post('<?php echo U('Comment/good');?>',{id:id},function(data){
			if(data == 1){
				var count = parseInt($(obj).find('span').text()) + 1;
				$(obj).find('span').text(count);
			}
		});
	}
	function bad(obj,id){
		$.post('<?php echo U('Comment/bad');?>',{id:id},function(data){
			if(data == 1){
				var count = parseInt($(obj).find('span').text()) + 1;
				$(obj).find('span').text(count);
			}
		});
	}
</script>


<script src="/Public/Home/js/bootstrap.min.js"></script>
<script src="/Public/Home/js/jquery.ias.js"></script>
<script src="/Public/Home/js/scripts.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript">
	function login(url){
		layer.open({
			  type: 2,
			  area: ['700px', '450px'],
			  title: false,
			  closeBtn: 0,
			  shadeClose: true,
			  skin: 'yourclass',
			  content: url,
			});
		
	}
</script>

</body>
</html>